<?php


namespace part16_StateMode\Code2;


class Work
{
    private $hour;
    private $taskFinished = false;

    public function setHour($hour)
    {
        $this->hour = $hour;
    }

    public function getHour()
    {
        return $this->hour;
    }

    public function setTaskFinished($taskFinished)
    {
        $this->taskFinished = $taskFinished;
    }

    public function getTaskFinished()
    {
        return $this->taskFinished;
    }

    public function writeProgram()
    {
        if ($this->hour < 12) {
            echo "当前时间：$this->hour 点 上午工作，精神百倍\n";
        } elseif ($this->hour < 13) {
            echo "当前时间：$this->hour 点 饿了，午饭；犯困，午休\n";
        } elseif ($this->hour < 18) {
            echo "当前时间：$this->hour 点 下午状态还不错，继续努力\n";
        } else {
            if ($this->taskFinished) {
                echo "当前时间：$this->hour 点 下午回家了\n";
            } else {
                if ($this->hour < 21) {
                    echo "当前时间：$this->hour 点 加班哦，疲惫至极\n";
                } else {
                    echo "当前时间：$this->hour 点 不行了，睡着了。\n";
                }
            }
        }
    }

}